#include <bits/stdc++.h>
using namespace std;
const int jin = 678;
const int maxn = 50+2;
const int maxt = 180*maxn+jin;
typedef pair<int, int> pii;
pii dp[maxn][maxt];
int len[maxn];
int main() {
    ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
    int T; cin >> T;
    for (int k = 1; k <= T; ++k) {
        memset(dp, 0, sizeof(dp));
        int n, t;
        cin >> n >> t;
        len[n+1] = jin;
        for (int i = 1; i <= n + 1; ++i) {
            if(i<=n) cin >> len[i];
            for (int j = 0; j <= t; ++j) {
                dp[i][j] = dp[i - 1][j];
                if (i <= n && j >= len[i]) {
                    pii tmp = dp[i - 1][j - len[i]];
                    tmp.first++;
                    tmp.second += len[i];
                    dp[i][j] = max(dp[i][j], tmp);
                } else if (i == n + 1 && j) {
                    pii tmp = dp[i - 1][j - 1];
                    tmp.first++;
                    tmp.second += len[i];
                    dp[i][j] = max(dp[i][j], tmp);
                }
            }
        }
        cout << "Case " << k << ": " << dp[n+1][t].first << " " << dp[n+1][t].second << "\n";
    }
    return 0;
}